package com.zhongli.devplatform.security;

import com.zhongli.devplatform.bean.SecurityUser;
import org.springframework.security.authentication.AbstractAuthenticationToken;


public class JwtAuthenticationToken extends AbstractAuthenticationToken {


    private SecurityUser securityUser;


    public JwtAuthenticationToken(String weixinId) {

        super(null);
        super.setAuthenticated(false);// 注意这个构造方法是认证时使用的
    }

    public JwtAuthenticationToken(String weixinId, SecurityUser user) {
        super(user.getAuthorities());
        this.securityUser = user;
    }


    @Override
    public Object getCredentials() {
        return securityUser.getPassword();
    }

    @Override
    public Object getPrincipal() {

        return securityUser;
    }
}
